package com.java.main.util;

import java.util.EnumSet;
import java.util.HashMap;
import java.util.Map;

public enum ErrorCode {

	OK("0", "成功"),
	ERROR("500", "服务器错误"),
	PARAMTER_ERROR("501", "参数错误"),
	MAC_ERROR("502", "Mac生成错误"),


	ToJson_ERROR("5001001","对象转Json错误"),
	FromJsonToObject_ERROR("5001002","Json转对象错误"),
	
	UserReg_PassMD5Error("070006", "加密密码错误"), 
	UserReg_UserMacError("070007", "生成用户校验码错误"),
	UserReg_UserExists("0013", "用户已注册"),
	UserReg_UserPause("000012", "用户已暂停"),
	UserReg_AccountMacError("070008", "账户校验码错误"),
	UserReg_MobileIdError("0019", "手机号错误"),
	UserReg_EmailError("0020", "邮箱错误"),
	UserReg_UsernameError("0021", "用户名错误"),
	UserReg_ChannelError("0022", "用户名Channel错误"),
	UserReg_NicknameExists("100105", "昵称已存在"),
	
	UserMod_UserNoEmpty("100001", "用户userno为空"),
	UserMod_UserNotExists("100002", "用户不存在"),
	UserMod_MobileidBind("100003", "用户手机号已绑定"),
	UserMod_EmailBind("100004", "用户邮箱已绑定"),
	UserMod_ZfbuserifBind("100006", "用户支付宝user_id已绑定"),
	UserMod_NicknameNotExists("100205", "昵称不存在"),
	UserMod_StateNotNormal("100206", "用户状态不正常"),
	UserMod_UsernameNotallowMod("100207", "用户名不允许修改"),
	UserMod_IDCard_LengthError("100208","身份证号码长度应该为15位或18位"),
	UserMod_IDCard_LastNumError("100209","身份证15位号码都应为数字 ; 18位号码除最后一位外，都应为数字"),
	UserMod_IDCard_BirthError("100210","身份证生日无效"),
	UserMod_IDCard_AddressError("100211","身份证地区编码错误"),
	UserMod_IDCard_Error("100212","身份证无效，不是合法的身份证号码"),
	UserMod_IDCard_EXIST("100213","身份证已经存在,不能修改"),
	// 大客户用户的注册接口 
	BigUserSubChannel_NotExistsError("100018", "该用户所属的大客户不存在"),
	BigUserBs_IsNullError("100019", "传过来的参数-同一个大客户内部使用的用户标识为空"),
	BigUserSubChannel_IsNullError("100020", "传过来的参数-大客户标识为空"),
	BigUser_HaveExist("100021", "该[大客户]用户已经注册过了"),
	BigUserType_IsNullError("100026", "传过来的参数-大客户外部用户类型为空"),
	// 大客户用户的查询接口 
	BigUser_Query_Exists("100022", "该[大客户]用户存在并返回UERNO"),
	BigUser_Query_NotExists("100023", "该[大客户]用户不存在"),
	//支付宝联合登录用户绑定
	BigUser_JointLogin_Bind_Userno_AlreadyBinded("100024","该手机用户已绑定"),
	BigUser_JointLogin_Bind_Userbs_AlreadyBinded("100025","该外部userid已绑定"),
	//体彩投注返回
	UserRes_LotControlExist("20100704","该期已经存在"),
	UserRes_LotControlNotExist("20100705","该期不存在"),
	UserRes_LotControlExpired("20100706","该期已经过期"),
	UserRes_IssueFormatError("20100707","期号格式不正确"),
	UserRes_DJYC("20100701","冻结异常"),
	UserRes_KKYC("20100702","扣款异常"),
	UserRes_YEYC("20100710","余额不足"),
	UserRes_JDYC("20100703","解冻异常"),
	UserRes_JDJEBZ("20100711","解冻金额不足"),
	UserRes_CPCC("0000","出票成功"),
	UserRes_GZSB("040014","彩票构造，交易记录插入，失败 "),
	UserRes_TZSB("040022","投注失败"),
	UserMod_UserNameNoAllowMod("100005", "用户名不允许修改"),
	UserRes_UserClosed("20100708","关闭用户不能执行操作"),
	UserRes_UserNotExist("20100709","用户不存在"),
	UserRes_UserLocked("20100712","用户被锁定"),
	Data_MD5("08001","md5验证错误"),	
	SMS_InvalidChannel("09001","无效的短信通道"),
	Xianhao("20100713", "限号"),
	BetFail("20109999", "出票失败"),

	Tlot_LotnoEmpty("200001", "lotNo为空"),
	Tlot_AmountError("200002", "amount金额错误"),
	Tlot_BetCodeError("200003", "betCode注码错误"),
	Tlottype_NotExists("200004", "lotNo彩种不存在"),
	Tlotctrl_NotExists("200005", "期号不存在"),
	Tlot_LotMultiError("200006", "lotMulti倍数错误"),
	Tlot_BatchNumError("200007", "batchNum追号期数错误"),
	Tlot_OneAmountError("200008", "oneAmount金额错误"),
	Tlot_TlottcNotExist("200009", "该flowno对应的票不存在"),
	Tlot_BuildSellCommandError("200010", "构造销售命令失败"),
	Tlot_FindFreeTtmctrlError("200011", "获取空闲逻辑机失败"),
	Tlot_TplataccountAmtNotEnough("200012", "所有机构账户余额都不足以支付投注金额"),
	InternetError("200013", "网络异常"),
	Tlot_AccountNotExit("200014", "账户不存在"),
	Tlot_AccountNotEnough("200015", "账户金额不足"),
	TLot_FindTplataccountError("200016", "获得机构账户失败"),
	Tlot_NotExists("200017", "Tlot不存在"),
	Tsubscribe_NoJiMaiJiFu("200018", "追号记录不存在或追号状态不为即买即付"),
	Tlot_OnSuccessError("200019", "出票成功,成功处理出错"),
	Tlot_OnFailError("200020", "出票失败,失败处理出错"),
	Tlot_BetFail("200021", "投注失败"),
	Tlot_MachinenoError("200022","票面逻辑机号不匹配"),
	Tlot_RuncodeError("200023","票面流水号不匹配"),
	Torder_SubscribeAmountError("200024","追号金额不正确"),
	Tjingcaimatches_NotExists("200025", "场次不存在"),
	Tjingcaimatches_Expired("200026", "场次已过期"),
	Tsubscribe_NoAllowCancel("200027", "追号不允许撤消"),
	Tlot_PauseSell("200028", "彩种暂停销售"),
	Tlot_StopSell("200029", "彩种停止销售"),
	Tjingcaimatches_unsupport("200030", "不支持此玩法"),
	Tbeidanmatches_NotExists("200031","北单赛事不存在"),
	Tbeidanmatches_Expired("200032","北单赛事已过期"),
	Tjingcaimatches_No_Letpoint("200033", "场次让球不为1或者-1"),
	Tjingcaimatches_2C1_Code_Err("200034", "2选1投注选项不正确"),
	Torder_bettype_err("200035", "订单投注类型错误"),
	Torder_userno_err("200036", "订单不属于该用户"),
	Torder_dlt2in12_err("200037", "12选2不支持追加"),
	
	Ttransaction_BankIdEmpty("300001", "bankId为空"),
	Ttransaction_Empty("300002", "Ttransaction为空"),
	Ttransaction_FlownoEmpty("300003", "flowno为空"),
	Ttransaction_AmtEmpty("300004", "amt为0"),
	Ttransaction_AlreadySuccess("300005", "Ttransaction已经成功"),
	Ttransaction_AmtTransaferException("300006", "交易金额转换异常"),
	Ttransaction_AmtCompareError("300007", "平台返回金额与本地数据库金额不符"),
	Ttransaction_BankCountEmpty("300008", "bankAccount为空"),
	Ttransaction_StateNotProcessing("300009", "失败处理交易状态不是处理中"),
	Ttransaction_NotExists("300010", "Ttransaction不存在"),
	Taccount_NotExists("300011", "Taccount不存在"),
	Taccount_DrawamtChangeError("300012", "可提现金额变动数有误"),
	Ttransaction_AmtIsValid("300013", "amt非法"),
	Taccount_DrawamtNotEnough("300014", "可提现余额不足"),
	Taccount_TtransferNotExists("300015", "Ttransfer不存在"),
	Taccount_TtransferStateValid("300016", "Ttransfer处于无效状态"),
	Ttransaction_NotChongZhi("300017","Ttransaction不是充值记录"),
	Taccount_CannotUseZFB2Withdraw("300018","不能用支付宝进行提现"),
	
	Taccountdetail_BeginTimeError("400001", "beginTime开始时间为空"),
	Taccountdetail_EndTimeError("400002", "endTime开始时间为空"),
	Taccountdetail_Empty("400003", "taccountdetail账户变动明细为空"),
	Select_NotExist("400004","查询结果不存在"),
	Taccountdetail_AmtInadequate("400005", "提现金额不足"),
	Taccountdetail_TcashDetailEmpty("400006", "提现记录为空"),
	Taccountdetail_TcashDetailReview("400007", "提现需求已进入审核状态，不允许修改"),
	Taccountdetail_TcashDetailNotExist("400008", "用户取消提现记录已存在或用户提现记录不存在"),
	Tdnabind_NotExists("400009", "Tdnabind不存在"),	
	Tdnabind_NotDndBindCard("400010", "非DNA绑定卡"),
	Tcash_NameEmpty("400011", "提现人姓名为空"),
	Tcash_NameNotEquals("400012", "提现人姓名与用户信息中填写的姓名不一致"),
	Tcash_NameNotEqualsDNA("400013", "提现人姓名与DNA绑定信息中填写的姓名不一致"),
	
	CaseLot_NotExist("500001", "合买方案不存在"),
	CaseLot_Full("500002","合买方案已满"),
	CaseLot_NotStarter("500003", "只有发起者才能取消"),
	CaseLot_SafeAmtError("500004", "保底金额异常"),
	CaseLot_RetractNotSelf("500005", "只有合买本人才能撤资"),
	CaseLot_CancelCaseLotError("500006", "合买撤销异常"),
	CaseLot_RateBigger50Error("500007", "撤销的合买进度大于50%"),
	CaseLot_CancelCaseLotBuyError("500008", "合买撤资异常"),
	CaseLot_StarterCanntCancelCaseLotBuy("500009", "合买发起人不能撤资"),
	CaseLot_RetractBigger20Error("500010", "撤资的合买进度大于20%"),
	CaseLot_LotControlExpired("500011", "合买已过截止时间"),
	CaseLot_OrderNotExist("500012", "该合买订单不存在"),
	CaseLot_CaseLotApplying("500013", "合买置顶申请处理中"),
	CaseLot_CaseLotHasApplied("500014", "合买置顶申请已处理"),
	CaseLot_CaseLotCelebrityExist("500015", "合买名人已存在"),
	CaseLot_CaseLotNumAndSafeZero("500016", "合买金额不能都为零"),
	CaseLot_TotalAmtLessthanRequirements("500017", "合买总金额小于要求"),
	
	Torder_LotEmpty("600001","订单中投注信息为空"),
	Torder_CanNotPrizeForNotOkOrder("600002","不能为未成功的票派奖"),
	Torder_HasPrized("600003","已派奖"),
	Torder_NoPrized("600004","未中奖"),

	Statistic_ParaWrong("700001","统计中奖参数错误"),
	MissValue_ParaWrong("700002","遗漏值参数错误"),
	
	UpdateOnPrize_ParaWrong("800001","更改计算奖金状态参数错误"),
	
	Caitongtc_FtpError("900001", "山东体彩下载文件失败"),
	Caitongtc_HttpDownError("900002", "山东体彩下载文件失败"),
	//大客户返回代码
	Success("0","请求成功"),
	NotExist("2","结果不存在"),
	SignError("102","签名验证未通过"),
	NOTFUNCTION("103","请求不存在"),
	IpError("199","ip验证未通过"),
	IsPass("0000","验证通过"),
	OrderidRepeat("2007","订单号重复"),
	ErrorRequest("501","发送Http请求出错"),
	SystemError("9999","系统错误"),
	DatabaseError("01001","数据库插入错误"),
	NoUser("040001","代理商不存在"),
	MoblieidError("040009","手机号码不正确"),
	ParametersIsNull("040009","参数不全"),
	
	PRESENT_Randomcode_Timeout("8010001","验证码已过期"),
	PRESENT_Random_Error("8010002","验证码错误"),
	PRESENT_Often_Submit("8010003","请不要频繁提交"),
	PRESENT_SendSMS_Error("8010004","发送短信失败"),
	PRESENT_No_Mobile("8010005","赠送没有手机号"),
	PRESENT_Has_Receive("8010006","赠送已领取"),
	PRESENT_Has_DNA("810007","由于您使用了银联语音充值,为保障您银行卡的资金安全,此账户不能做赠送"),
	
	ActionCenter_HadJoin("8020001","活动已参加，只能参加一次"),
	
	ScoreCenter_NOT_ENOUGH("1010001","积分不足"),
	ScoreCenter_Tran2MoneyLotmulti_Error("1010002","积分兑换倍数错误"),
	ScoreCenter_Tran2Money_DISABLE("1010003","积分兑换不可用"),
	ScoreCenter_TYPE_DISABLE("1010004","无效的积分类型"),
	
	AgentCenter_AgentExists("1020001","代理用户已存在"),
	AgentCenter_ParentAgentNotExists("1020002","上级代理用户不存在"),
	AgentCenter_CommisionRatioCannotDown("1020003","佣金比例不能调低"),
	
	AutoJoin_JoinAmtError("1120001","跟单金额错误"),
	AutoJoin_PercentNumError("1120002","百分比错误"),
	AutoJoin_CANNT_JOIN_SELF("1120003","不能自动跟单自己的合买"),
	
	TradeQuery_tradenoIsEmpty("910001", "交易号为空"),
	TradeQuery_transdateIsEmpty("910002", "交易日期为空"),
	TradeQuery_transnoOrTransactionidIsEmpty("910003", "订单号或交易号为空"),
	
	BatchPay_batchnoNotExist("920001", "批次号不存在"),
	BatchPay_cashdetailTypeNotAlipay("920002", "提现类型非支付宝"),
	BatchPay_AlreadySuccess("920003", "该提现已经成功"),
	BatchPay_cashdetailStateNotShenghezhong("920004", "该提现非已审核状态"),
	BatchPay_cashdetailIdsEmpty("920005", "提现Id为空"),
	BatchPay_cashdetailNotExist("920006", "提现记录不存在"),
	BatchPay_batchnoDiscordant("920007", "提现批次号不一致"),
	BatchPay_amtError("920008", "提现金额错误"),
	NET_ERROR("920010", "网络错误"),
	TOKEN_ERROR("920009", "token错误");

	public String value;

	public String memo;

	ErrorCode(String value, String memo) {
		this.value = value;
		this.memo = memo;
	}

	private static final Map<String, ErrorCode> lookup = new HashMap<String, ErrorCode>();

	static {
		for (ErrorCode s : EnumSet.allOf(ErrorCode.class)) {
			lookup.put(s.value, s);
		}
	}

	public static ErrorCode get(String value) {
		return lookup.get(value);
	}
}
